
     @include('common.header')

     <script>
      function search(){
        var name = $("#name").val();
        var team = $("#team").val();
        var url = "/land/search/"+team+"/"+name;
        alert(url);
        window.location = url;
    }

    // $(document).ready(function(){
    // $('#name').autocomplete({
    //     autoFocus: true,
    //     minLength:1,
    //     dataType: "json",
    //     source:'/landowner/autocomplete',
    //     select:function(event, ui){
    //         alert(ui);
    //     }   
    // });

     </script>
        <div class="content col-xs-12 col-sm-10">
                       <div class="banner">
                            <p class="fl">土地信息</a> </p>
                            <p class="fr"><a href="/land/create">添加</a> </p>
                        </div>

           <table>
            
            <tr>
              <td>组别</td>
              <td><select id="team" name="team" class="form-control">
                <option value="all">全部</option>;
                @php
                $teams = json_decode(LAND_TEAM, true);
                @endphp
                @foreach ($teams as $team)
                <option value="{{$team}}">{{$team}}</option>;
                @endforeach 
            
              </select></td>
            
              <td>姓名</td>
              <td><input type="text" id="name" name="name" class="form-control" required="required"></td>
              <td><button type="button" onclick="search()">搜索</button></td>
            </tr> 
        </table>
       
                  
                        <div class="table">
                            <table>
                                <thead>
                                    <tr>
                                        <td width="9%">农户</td>
                                        <td>类型</td>
                                        <td>地块名称</td>
                                        <td>面积</td>
                                        <td>单价</td>
                                        <td>总价</td>
                                        <td>合同编号</td>
                                        <td>修改</td>
                                        <td>删除</td>
                                    </tr>
                                </thead>
                                <tbody>

                            @php
                            $area_total = 0;
                            $price_total = 0;
                            
                            @endphp
                            @foreach ($lands as $land)
                            <tr>
                                      <td>{{ $land->loname }}</td>
                                      <td>
                                        @if ($land->catalog == CATALOG_SHANDI1)
                                          一类山地
                                        @elseif ($land->catalog == CATALOG_SHANDI2)
                                          二类山地
                                        @else
                                          塬地
                                        @endif
                                      </td>
                                           <td>{{ $land->name }}</td>
                                   
                                        <td>{{ $land->area }}</td>
                                        <td>{{ $land->price }}</td>
                                        <td>{{ $land->amount }}</td>
                                        <td>{{ $land->contract_code }}</td>
                                        <td><a href="/land/modify/{{$land->id}}">修改</a></td>
                                        <td><a href="/land/delete/{{$land->id}}">删除</a></td>
                                 
                                        </tr>

                                        @php
                                        $area_total += $land->area;
                                        $price_total += $land->price*$land->area;
                                        @endphp
                            @endforeach  

                            <tr> <td colspan="9" align="left"><span class="blue">
                              总亩数：<span class="green">{{$area_total}}亩</span> 
                              总金额：<span class="green">{{$price_total}}元</span></span</td>
                            </tr>       
                                          
                          </tbody>
                                
                            </table>
                        </div>
                    
                   <!--  <div class="page">
              <div class="big first fl">首页</div>
              <div class="big fl">←</div>
              <div class="num cur fl">1</div>
              <div class="num fl">2</div>
              <div class="num fl">3</div>
              <div class="num fl">4</div>
              <div class="num fl">5</div>
              <div class="big fl">→</div>
              <div class="big last fl">末页</div>
            </div> -->
                </div>
        
        <script type="text/javascript">
    
        $("table tbody tr:even").css("backgroundColor","#FFF");
        $("table tbody tr:odd").css("backgroundColor","#EBF9FF");
        
        </script>

   @include('common.footer')
  
